UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4q9Wj8ORwYPTaOBqSoIlg881N85Wo4QQfIm1wRBwnM=' 
WHERE 
  key_id = '42ea271602d597187a189784c30cc1e20999b21ac994d19c7f84754656b0c3a0' 
  AND (
    token = 'U4q9Wj8ORwYPTaOBqSoIlg881N85Wo4QQfIm1wRBwnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030