UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'idljguN2tmctfC/mgSyNBX2LlvLxWlo3vkj/Y4yqLTg=' 
WHERE 
  key_id = '8f0b0fbb59517a92898462cbde6c15babcf19df85f94862039f46afcb1323119' 
  AND (
    token = 'idljguN2tmctfC/mgSyNBX2LlvLxWlo3vkj/Y4yqLTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047