UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbbCn6mHWs+8lFpqmJc2Vm+w5kQsvr6SP9cVKUCjdmQ=' 
WHERE 
  key_id = 'b89af6599563fcd67998764c7da636a1d925bebb135225ca50109de1d24eb996' 
  AND (
    token = 'dbbCn6mHWs+8lFpqmJc2Vm+w5kQsvr6SP9cVKUCjdmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032