UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ADubQpuXmN73uawxretC1vCEIJoG+skmy9Na4w0U2Dk=' 
WHERE 
  key_id = '22bfc623fec121f466110e5fcef0f0fab493fe6dd1a77029062ec718cdd19fda' 
  AND (
    token = 'ADubQpuXmN73uawxretC1vCEIJoG+skmy9Na4w0U2Dk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034