UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IlCCPVtQiUq+DC334uGn9BAK0niGyFdURXzqplFJl7g=' 
WHERE 
  key_id = 'eddc8b4743059adbdf3a58cd645ae54d1e455093652d0bd5f9303a508a996ed2' 
  AND (
    token = 'IlCCPVtQiUq+DC334uGn9BAK0niGyFdURXzqplFJl7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032