UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5vTb9y0FSUua1rlcpyn2LVJmXza4zRExshXm0W5Es8=' 
WHERE 
  key_id = 'ac223d4f405c6743d560d873b0ecb8c8664fde556fb653641caf21d46715ad37' 
  AND (
    token = 'A5vTb9y0FSUua1rlcpyn2LVJmXza4zRExshXm0W5Es8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037