UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qb5WneKNdLlpJK76XeMzcB85W/3pP7SBx2VYu6NDAjk=' 
WHERE 
  key_id = '00cfcd0af32686b513e1271dfb718f5fee08c31173ab0cee1b4d2ec03a38469b' 
  AND (
    token = 'Qb5WneKNdLlpJK76XeMzcB85W/3pP7SBx2VYu6NDAjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017