UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w6K60V/G6s7X0/UXlvhLc3mbjKIwC/PumWXlZYXmSuM=' 
WHERE 
  key_id = 'a066d682e9045e39f248c33c2d8f527b00f8e8cb3270c5948127fda7bca523d1' 
  AND (
    token = 'w6K60V/G6s7X0/UXlvhLc3mbjKIwC/PumWXlZYXmSuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032