UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SQBHieWgouh/qomt6UgDhZ0n0SgeQwR/t+5jn49zDsw=' 
WHERE 
  key_id = '30366982deec0b1376bf09a56bb673e01e97bb7925ac4386162044a0477310d5' 
  AND (
    token = 'SQBHieWgouh/qomt6UgDhZ0n0SgeQwR/t+5jn49zDsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055