UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BTWrYu3c8TRFxeiWTr9srLGVPhnC++ME87xVAA0kakk=' 
WHERE 
  key_id = '04b3c30c6fdf10c12f6d1586c3edc158b6ae7a5acf8ebb3e7e7015fcb441ac80' 
  AND (
    token = 'BTWrYu3c8TRFxeiWTr9srLGVPhnC++ME87xVAA0kakk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040