UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HbcEdeLsRs75ID5JuJZYgpG2dpEbYM3KGorzNse0naM=' 
WHERE 
  key_id = 'a387d0536c8b2df8f1a5f2c3fc013637e4a7b039888092c7296a1745eef0288f' 
  AND (
    token = 'HbcEdeLsRs75ID5JuJZYgpG2dpEbYM3KGorzNse0naM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048