UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T5Vj2ika0Iv59y4T6p5o4GzbPQdzeix3+FcOCA6cj/8=' 
WHERE 
  key_id = 'c852099b98a615693e1024b4c4578cf2c68f7bf83078c337e6fe8a9c7920876d' 
  AND (
    token = 'T5Vj2ika0Iv59y4T6p5o4GzbPQdzeix3+FcOCA6cj/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043