UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hji0Xks3Z+WFejVnfi4pdawE8Oplz/clo2LXzkOq8xQ=' 
WHERE 
  key_id = '3009978c546e72bdb7d8e91f6a91d04396a2ccc334eef79d8a80b51204790234' 
  AND (
    token = 'hji0Xks3Z+WFejVnfi4pdawE8Oplz/clo2LXzkOq8xQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041