UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CCqVoHqTc7UGt9Bk4CPXyumsP49fY1U8md/K0jkhtsY=' 
WHERE 
  key_id = '21264faf6e5741a625fa29e04bd6b8019109458553ae0e560238599a497a8e10' 
  AND (
    token = 'CCqVoHqTc7UGt9Bk4CPXyumsP49fY1U8md/K0jkhtsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038